<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="/app/admin/component/layui/css/layui.css?v=2.8.12" />
        <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
    </head>
    <body class="pear-container">
        <style>
            .layui-input-block input {
                width: 300px;
            }
            .layui-input-block textarea {
                width: 400px;
            }
            /*.smsInfo .layui-form-label{*/
            /*    width: 200px;*/
            /*}*/
        </style>

        <div class="layui-card">
            <div class="layui-card-body">

                <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">网站设置</li>
                    <li>短信设置</li>
                    <li>支付设置</li>
                    <li>认证设置</li>
                    <li>客服设置</li>
                    <li>节点设置</li>
                    <li>返佣设置</li>
                    <li>提现设置</li>
                    <li>菜单配置</li>
                    <li>页面配置</li>
                </ul>
                <div class="layui-tab-content">

                    <!-- 基本信息 -->
                    <div class="layui-tab-item layui-show">

                        <form class="layui-form" lay-filter="baseInfo">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">网站名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" required  lay-verify="required" placeholder="请输入网站名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">网站链接</label>
                                <div class="layui-input-block">
                                    <input type="text" name="url" placeholder="请输入网站链接" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">网站Logo</label>
                                <div class="layui-input-block">
                                    <img class="img-3" src=""/>
                                    <input type="text" style="display:none" name="image" value="/app/admin/avatar.png" />
                                    <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="image" permission="app.admin.upload.avatar">
                                        <i class="layui-icon layui-icon-upload"></i>上传图片
                                    </button>
                                    <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" id="attachment-choose-image" permission="app.admin.upload.attachment">
                                        <i class="layui-icon layui-icon-align-left"></i>选择图片
                                    </button>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">ICP备案号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="icp"  placeholder="请输入ICP备案号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">公安网备</label>
                                <div class="layui-input-block">
                                    <input type="text" name="beian" placeholder="请输入公安网备号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">公司名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="company_name" placeholder="请输入公司名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">注册链接</label>
                                <div class="layui-input-block">
                                    <input type="text" name="register_url" placeholder="请输入注册链接" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">软件下载</label>
                                <div class="layui-input-block">
                                    <input type="text" name="download_url" placeholder="请输入软件下载链接" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">用户协议</label>
                                <div class="layui-input-block">
                                    <textarea name="agreement_user" id="agreement_user" placeholder="请输入用户协议" class="layui-textarea"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">隐私政策</label>
                                <div class="layui-input-block">
                                    <textarea name="agreement_privacy" id="agreement_privacy" placeholder="请输入隐私政策" class="layui-textarea"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">儿童保护及监护人须知</label>
                                <div class="layui-input-block">
                                    <textarea name="agreement_child" id="agreement_child" placeholder="请输入儿童保护及监护人须知" class="layui-textarea"></textarea>
                                </div>
                            </div>
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">其它</label>-->
<!--                                <div class="layui-input-block">-->
<!--                                    <input type="text" name="footer_txt" placeholder="其它展示在页面底部的内容" autocomplete="off" class="layui-input">-->
<!--                                </div>-->
<!--                            </div>-->

                            <div class="layui-form-item">
                                <label class="layui-form-label">开启节点命令</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="user_api_switch" id="user_api_switch" lay-skin="switch" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveBaseInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 短信设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form smsInfo" lay-filter="smsInfo">

                            <div class="layui-form-item">
                                <label class="layui-form-label">短信类型</label>
                                <div class="layui-input-block">
                                    <div name="sms_type" id="sms_type" value="" style="width: 300px"></div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云accessKeyId</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alisms_username" placeholder="请输入阿里云accessKeyId" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云accessKeySecret</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alisms_password" placeholder="请输入阿里云accessKeySecret" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云签名名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alisms_sign_name" placeholder="请输入阿里云签名名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云模板编码-注册</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alisms_template_code_1" placeholder="请输入阿里云模板编码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云模板编码-重置密码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alisms_template_code_2" placeholder="请输入阿里云模板编码" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">助通融合云用户名</label>
                                <div class="layui-input-block">
                                    <input type="text" name="zthysms_username" placeholder="请输入助通融合云用户名" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">助通融合云接口密码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="zthysms_password" placeholder="请输入助通融合云接口密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">助通融合云签名名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="zthysms_sign_name" placeholder="请输入助通融合云签名名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">助通融合云模板编码-注册</label>
                                <div class="layui-input-block">
                                    <input type="text" name="zthysms_template_code_1" placeholder="请输入助通融合云模板编码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">助通融合云模板编码-重置密码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="zthysms_template_code_2" placeholder="请输入助通融合云模板编码" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveSmsInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 支付设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="payInfo">
<!--                            <div class="layui-form-item">-->
<!--                                <label class="layui-form-label">充值方式</label>-->
<!--                                <div class="layui-input-block">-->
<!--                                    <div name="recharge_pay_type" id="recharge_pay_type" value="" style="width: 300px"></div>-->
<!--                                </div>-->
<!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">支付宝APPID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alipay_app_id" placeholder="请输入支付宝APPID" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">支付宝应用私钥</label>
                                <div class="layui-input-block">
                                    <textarea name="alipay_app_secret_cert" placeholder="请输入支付宝应用私钥" class="layui-input" style="height: 200px"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">支付宝公钥证书</label>
                                <div class="layui-input-block">
                                    <textarea name="alipay_public_cert_path" placeholder="请输入支付宝公钥证书" class="layui-input" style="height: 200px"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">支付宝异步回调地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="alipay_notify_url" placeholder="请输入支付宝异步回调地址" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微信APPID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="wechat_app_id" placeholder="请输入微信APPID" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微信商户号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="wechat_mch_id" placeholder="请输入微信商户号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微信商户秘钥V2</label>
                                <div class="layui-input-block">
                                    <input type="text" name="wechat_mch_secret_key_v2" placeholder="请输入微信商户秘钥V2" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微信异步回调地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="wechat_notify_url" placeholder="请输入微信异步回调地址" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="savePayInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 认证设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="identInfo">

                            <div class="layui-form-item">
                                <label class="layui-form-label">认证类型</label>
                                <div class="layui-input-block">
                                    <div name="ident_type" id="ident_type" value="" style="width: 300px"></div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">AppKey</label>
                                <div class="layui-input-block">
                                    <input type="text" name="key" placeholder="请输入AppKey" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">AppSecret</label>
                                <div class="layui-input-block">
                                    <input type="text" name="secret" placeholder="请输入AppSecret" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">AppCode</label>
                                <div class="layui-input-block">
                                    <input type="text" name="appcode" placeholder="请输入AppCode" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">认证提示</label>
                                <div class="layui-input-block">
                                    <textarea name="ident_content" placeholder="请输入认证提示" class="layui-input" style="height: 200px"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveIdentInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 客服设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="kefuInfo">

                            <div class="layui-form-item">
                                <label class="layui-form-label">QQ</label>
                                <div class="layui-input-block">
                                    <input type="text" name="kefu_qq" placeholder="请输入QQ" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微信</label>
                                <div class="layui-input-block">
                                    <input type="text" name="kefu_weixin" placeholder="请输入微信" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveKefuInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 节点设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="orderInfo">

                            <div class="layui-form-item">
                                <label class="layui-form-label">保留时间</label>
                                <div class="layui-input-block">
                                    <input type="number" name="order_node_reserve_time" placeholder="请输入保留时间" autocomplete="off" class="layui-input" min="1">
                                    <div style="color: red">单位：小时 节点到期后保留时间</div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">平均时间</label>
                                <div class="layui-input-block">
                                    <textarea name="order_node_avg" placeholder="请输入平均时间" class="layui-input" style="height: 200px"></textarea>
                                    <div style="color: red">一行一条数据 "|"分割天数和价格</div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">开启自动续费</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="order_node_renew_auto" id="order_node_renew_auto" lay-skin="switch" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">到期前时间</label>
                                <div class="layui-input-block">
                                    <input type="number" name="order_node_renew_time" placeholder="到期前时间" autocomplete="off" class="layui-input" min="1">
                                    <div style="color: red">单位：天 节点到期前几天自动续费</div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">续费时间</label>
                                <div class="layui-input-block">
                                    <div name="order_node_renew_duration" id="order_node_renew_duration" value="" style="width: 300px"></div>
                                    <div style="color: red">要续费的时长</div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveOrderInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 返佣设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="commissionInfo">
                            <div class="layui-form-item">
                                <label class="layui-form-label">返佣类型</label>
                                <div class="layui-input-block">
                                    <div name="commission_type" id="commission_type" value="" style="width: 300px"></div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">返佣级数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="commission_level" placeholder="请输入返佣级数" autocomplete="off" class="layui-input" min="1">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveCommissionInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 提现设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="withdrawalInfo">
                            <div class="layui-form-item">
                                <label class="layui-form-label">最低提现金额</label>
                                <div class="layui-input-block">
                                    <input type="number" name="withdrawal_money" placeholder="请输入最低提现金额" autocomplete="off" class="layui-input" min="0">
                                    <div style="color: red">为0不限制</div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveWithdrawalInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- 菜单设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="menuInfo">
                            <div class="layui-form-item">
                                <label class="layui-form-label">菜单url</label>
                                <div class="layui-input-block">
                                    <input type="text" name="data" required  lay-verify="required" placeholder="请输入菜单url" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">默认菜单ID</label>
                                <div class="layui-input-block">
                                    <input type="number" name="select" required  lay-verify="required" placeholder="请输入默认菜单ID" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">开启手风琴</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="accordion" id="accordion" lay-skin="switch" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">折叠菜单</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" id="collapse" name="collapse" lay-skin="switch" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveMenuInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- tab设置 -->
                    <div class="layui-tab-item">

                        <form class="layui-form" lay-filter="tabInfo">

                            <div class="layui-form-item">
                                <label class="layui-form-label">保持标签</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="keepState" lay-skin="switch" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">记住标签</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="session" lay-skin="switch" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">预加载标签</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="preload" lay-skin="switch" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">最大标签数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="max" required  lay-verify="required" placeholder="请输入最大标签数" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">主标签标题</label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" required  lay-verify="required" placeholder="请输入主页标签标题" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">主标签URL</label>
                                <div class="layui-input-block">
                                    <input type="text" name="href" required  lay-verify="required" placeholder="请输入菜单url" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">主标签ID</label>
                                <div class="layui-input-block">
                                    <input type="number" name="id" required  lay-verify="required" placeholder="请输入主页标签ID" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit="" lay-filter="saveTabInfo">
                                        提交
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>

                </div>
            </div>

            </div>
        </div>


        <script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
        <script src="/app/admin/component/pear/pear.js"></script>
        <script src="/app/admin/admin/js/permission.js"></script>
        <script>

            // 基础设置
            layui.use(["upload", "layer", "popup",'tinymce'], function() {
                let $ = layui.$;
                let form = layui.form;

                // image
                let input = $("#image").prev();
                input.prev().attr("src", input.val());
                layui.$("#attachment-choose-image").on("click", function() {
                    parent.layer.open({
                        type: 2,
                        title: "选择附件",
                        content: "/app/admin/upload/attachment?ext=jpg,jpeg,png,gif,bmp",
                        area: ["95%", "90%"],
                        success: function (layero, index) {
                            parent.layui.$("#layui-layer" + index).data("callback", function (data) {
                                input.val(data.url).prev().attr("src", data.url);
                            });
                        }
                    });
                });
                layui.upload.render({
                    elem: "#image",
                    url: "/app/admin/upload/avatar",
                    acceptMime: "image/gif,image/jpeg,image/jpg,image/png",
                    done: function (res) {
                        if (res.code) {
                            return layui.popup.failure(res.msg);
                        }
                        this.item.prev().val(res.data.url).prev().attr("src", res.data.url);
                    }
                });

                // 编辑器
                var tinymce = layui.tinymce
                var agreement_user = tinymce.render({
                    elem: "#agreement_user",
                    'lay-verify': "required",
                    placeholder: "请输入内容",
                    images_upload_url: "/app/admin/upload/image",
                    height: 500
                });
                agreement_user.on("blur", function(){
                    layui.$("#agreement_privacy").val(agreement_user.getContent());
                });
                var agreement_privacy = tinymce.render({
                    elem: "#agreement_privacy",
                    'lay-verify': "required",
                    placeholder: "请输入内容",
                    images_upload_url: "/app/admin/upload/image",
                    height: 500
                });
                agreement_privacy.on("blur", function(){
                    layui.$("#agreement_privacy").val(agreement_privacy.getContent());
                });
                var agreement_child = tinymce.render({
                    elem: "#agreement_child",
                    'lay-verify': "required",
                    placeholder: "请输入内容",
                    images_upload_url: "/app/admin/upload/image",
                    height: 500
                });
                agreement_child.on("blur", function(){
                    layui.$("#agreement_child").val(agreement_child.getContent());
                });

                // 提交
                form.on("submit(saveBaseInfo)", function(data){
                    data.field.agreement_user = agreement_user.getContent();
                    data.field.agreement_privacy = agreement_privacy.getContent();
                    data.field.agreement_child = agreement_child.getContent();
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {logo: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 菜单设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveMenuInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {menu: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 标签设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveTabInfo)", function(data){
                    let field = data.field;
                    field.index = {
                        id: field.id,
                        href: field.href,
                        title: field.title,
                    };
                    delete data.field;
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {tab: field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    // 删除sessionStorage缓存
                    sessionStorage.clear();
                    return false;
                });
            });

            layui.use(["form"], function () {
                let form = layui.form;
                let $ = layui.$;
                $.ajax({
                    url: "/app/admin/config/get",
                    dataType: "json",
                    success: function (res) {
                        if (res.code) {
                            return layui.popup.failure(res.msg);
                        }
                        form.val("baseInfo", res.logo);
                        $("#image").prev().val(res.logo.image).prev().attr("src", res.logo.image);
                        form.val("menuInfo", res.menu);
                        let tab = res.tab;
                        let index = tab.index;
                        delete tab.index;
                        tab.id = index.id;
                        tab.title = index.title;
                        tab.href= index.href;
                        form.val("tabInfo", res.tab);

                        form.val("smsInfo", res.sms);
                        // 给表单初始化数据
                        layui.each(res.sms, function (key, value) {
                            let obj = $('*[name="'+key+'"]');
                            if (key === "sms_type") {
                                obj.attr("value", value);
                            }
                        });
                        // 字段 单选 ident_type
                        layui.use(["jquery", "xmSelect", "popup"], function() {
                            layui.$.ajax({
                                url: "/app/admin/dict/getNew/get_sms_type_list",
                                dataType: "json",
                                success: function (res) {
                                    let value = layui.$("#sms_type").attr("value");
                                    let initValue = value ? value.split(",") : [];
                                    layui.xmSelect.render({
                                        el: "#sms_type",
                                        name: "sms_type",
                                        initValue: initValue,
                                        filterable: true,
                                        data: res.data,
                                        model: {"icon":"hidden","label":{"type":"text"}},
                                        clickClose: true,
                                        radio: true,
                                        layVerify: "",
                                    });
                                    if (res.code) {
                                        layui.popup.failure(res.msg);
                                    }
                                }
                            });
                        });

                        form.val("payInfo", res.pay);
                        // 给表单初始化数据
                        // layui.each(res.pay, function (key, value) {
                        //     let obj = $('*[name="'+key+'"]');
                        //     if (key === "recharge_pay_type") {
                        //         obj.attr("value", value);
                        //     }
                        // });
                        // 字段 多选 recharge_pay_type
                        // layui.use(["jquery", "xmSelect", "popup"], function() {
                        //     layui.$.ajax({
                        //         url: "/app/admin/dict/getNew/get_pay_type_list",
                        //         dataType: "json",
                        //         success: function (res) {
                        //             let value = layui.$("#recharge_pay_type").attr("value");
                        //             let initValue = value ? value.split(",") : [];
                        //             layui.xmSelect.render({
                        //                 el: "#recharge_pay_type",
                        //                 name: "recharge_pay_type",
                        //                 initValue: initValue,
                        //                 filterable: true,
                        //                 data: res.data,
                        //                 toolbar: {"show":true,"list":["ALL","CLEAR","REVERSE"]},
                        //             });
                        //             if (res.code) {
                        //                 layui.popup.failure(res.msg);
                        //             }
                        //         }
                        //     });
                        // });

                        form.val("identInfo", res.ident);
                        // 给表单初始化数据
                        layui.each(res.ident, function (key, value) {
                            let obj = $('*[name="'+key+'"]');
                            if (key === "ident_type") {
                                obj.attr("value", value);
                            }
                        });
                        // 字段 单选 ident_type
                        layui.use(["jquery", "xmSelect", "popup"], function() {
                            layui.$.ajax({
                                url: "/app/admin/dict/getNew/get_ident_type_list",
                                dataType: "json",
                                success: function (res) {
                                    let value = layui.$("#ident_type").attr("value");
                                    let initValue = value ? value.split(",") : [];
                                    layui.xmSelect.render({
                                        el: "#ident_type",
                                        name: "ident_type",
                                        initValue: initValue,
                                        filterable: true,
                                        data: res.data,
                                        model: {"icon":"hidden","label":{"type":"text"}},
                                        clickClose: true,
                                        radio: true,
                                        layVerify: "",
                                    });
                                    if (res.code) {
                                        layui.popup.failure(res.msg);
                                    }
                                }
                            });
                        });

                        form.val("kefuInfo", res.kefu);

                        form.val("orderInfo", res.order);
                        // 给表单初始化数据
                        layui.each(res.order, function (key, value) {
                            let obj = $('*[name="'+key+'"]');
                            if (key === "order_node_renew_duration") {
                                obj.attr("value", value);
                            }
                        });
                        // 字段 单选 order_node_renew_duration
                        layui.use(["jquery", "xmSelect", "popup"], function() {
                            layui.$.ajax({
                                url: "/app/admin/dict/getNew/get_duration_sec_list",
                                dataType: "json",
                                success: function (res) {
                                    let value = layui.$("#order_node_renew_duration").attr("value");
                                    let initValue = value ? value.split(",") : [];
                                    layui.xmSelect.render({
                                        el: "#order_node_renew_duration",
                                        name: "order_node_renew_duration",
                                        initValue: initValue,
                                        filterable: true,
                                        data: res.data,
                                        model: {"icon":"hidden","label":{"type":"text"}},
                                        clickClose: true,
                                        radio: true,
                                        layVerify: "",
                                    });
                                    if (res.code) {
                                        layui.popup.failure(res.msg);
                                    }
                                }
                            });
                        });

                        form.val("commissionInfo", res.commission);
                        // 给表单初始化数据
                        layui.each(res.commission, function (key, value) {
                            let obj = $('*[name="'+key+'"]');
                            if (key === "commission_type") {
                                obj.attr("value", value);
                            }
                        });
                        // 字段 单选 ident_type
                        layui.use(["jquery", "xmSelect", "popup"], function() {
                            layui.$.ajax({
                                url: "/app/admin/dict/getNew/get_commission_type_list",
                                dataType: "json",
                                success: function (res) {
                                    let value = layui.$("#commission_type").attr("value");
                                    let initValue = value ? value.split(",") : [];
                                    layui.xmSelect.render({
                                        el: "#commission_type",
                                        name: "commission_type",
                                        initValue: initValue,
                                        filterable: true,
                                        data: res.data,
                                        model: {"icon":"hidden","label":{"type":"text"}},
                                        clickClose: true,
                                        radio: true,
                                        layVerify: "",
                                    });
                                    if (res.code) {
                                        layui.popup.failure(res.msg);
                                    }
                                }
                            });
                        });

                        form.val("withdrawalInfo", res.withdrawal);
                    }
                });

            });

            // 短信设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveSmsInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {sms: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 支付设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(savePayInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {pay: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 认证设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveIdentInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {ident: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 客服设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveKefuInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {kefu: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 订单设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveOrderInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {order: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });
            });

            // 返佣设置
            layui.use(["upload", "layer", "popup"], function() {
                let $ = layui.$;
                let form = layui.form;
                // 提交
                form.on("submit(saveCommissionInfo)", function(data){
                    $.ajax({
                        url: "/app/admin/config/update",
                        dataType: "json",
                        type: "POST",
                        data: {commission: data.field},
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功");
                        }
                    });
                    return false;
                });

                // 提现设置
                layui.use(["upload", "layer", "popup"], function() {
                    let $ = layui.$;
                    let form = layui.form;
                    // 提交
                    form.on("submit(saveWithdrawalInfo)", function(data){
                        $.ajax({
                            url: "/app/admin/config/update",
                            dataType: "json",
                            type: "POST",
                            data: {withdrawal: data.field},
                            success: function (res) {
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }
                                return layui.popup.success("操作成功");
                            }
                        });
                        return false;
                    });
                });
            });

        </script>

    </body>
</html>
